MessageTray calls .size() very often to update the no messages label,
so a linear time implementation is not good enough.
https://bugzilla.gnome.org/show_bug.cgi?id=700194
_init: function(iterable) {
this._pool = { };
+ this._size = 0;
if (iterable) {
for (let i = 0; i < iterable.length; i++) {
node.value = value;
} else {
this._pool[hash] = { key: key, value: value };
+ this._size++;
}
},
if (node && _sameValue(node.key, key)) {
delete this._pool[hash];
+ this._size--;
return [node.key, node.value];
} else {
return [null, null];
},
size: function() {
- return Object.getOwnPropertyNames(this._pool).length;
+ return this._size;
},
});